package com.si.anddos;

import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
/**
 * A base class representing base of Options Menu in anddos application
 * All other activity classes inherit from this class
 * @author Carlos Martinez
 *
 */
public class OptionsMenuActivity extends Activity {
	 
	@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        // add about and settings items to option menu
        menu.add(0, Globals.ABOUT_ID, 0, R.string.menuAbout).setIcon(android.R.drawable.ic_menu_info_details);
        menu.add(0, Globals.SETTINGS_ID, 0, R.string.menuSettings).setIcon(android.R.drawable.ic_menu_manage);
        return true;
    }

    @Override
    public boolean onMenuItemSelected(int featureId, MenuItem item) {
    	//handling menu items click
        switch(item.getItemId()) {
            case Globals.ABOUT_ID:
            	// create and show about dialog
            	AboutDialog aboutDialog = new AboutDialog(this);
            	aboutDialog.show();
                return true;
            case Globals.SETTINGS_ID:
            	// start settings activity
            	Intent settingsActivity = new Intent(this, SettingsActivity.class);
            	startActivity(settingsActivity);
                return true;
        }

        return super.onMenuItemSelected(featureId, item);
    }
    

    
}
